package com.feiwo.nonego.rpc.proxy.api;

import com.feiwo.nonego.rpc.proxy.api.config.ProxyConfig;
import com.feiwo.nonego.rpc.proxy.api.object.ObjectProxy;

/**
 *
 *
 * @author feiwo 2025-08-08
 */
public abstract class BaseProxyFactory<T> implements ProxyFactory{

    protected ObjectProxy<T> objectProxy;

    @SuppressWarnings({"unchecked", "rawtypes", "TypeParameterHidesVisibleType"})
    @Override
    public <T> void init(ProxyConfig<T> proxyConfig) {
        this.objectProxy = new ObjectProxy(
                proxyConfig.getClazz(),
                proxyConfig.getServiceVersion(),
                proxyConfig.getServiceGroup(),
                proxyConfig.getConsumer(),
                proxyConfig.getSerializationType(),
                proxyConfig.isAsync(),
                proxyConfig.isOneway(),
                proxyConfig.getTimeout(),
                proxyConfig.getRegistryService());
    }
}
